﻿using FarPoint.Web.Spread;
using System;
using System.Web.UI.WebControls;

namespace ControlExplorer.samples.Skins
{
  public partial class Overview : SpreadDemoPage
  {
    protected override bool ApplyGlobalSkin
    {
      get
      {
        return false;
      }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
      if (IsPostBack) return;
      foreach (SheetSkin skin in DefaultSkins.Skins)
      {
        System.Web.UI.WebControls.MenuItem item = new System.Web.UI.WebControls.MenuItem("内置皮肤: " + skin.Name, skin.Name, IMAGE_FOLDER + "/gnome-graphics.png");
        this.SkinMenu.Items[0].ChildItems.Add(item);
      }
      this.FpSpread1.UseClipboard = false;
    }

    protected void SkinMenu_MenuItemClick(object sender, MenuEventArgs e)
    {
      SheetSkin skin = null;
      foreach (SheetSkin tmpSkin in DefaultSkins.Skins)
      {
        if (e.Item.Value.Equals(tmpSkin.Name))
        {
          skin = tmpSkin;
          break;
        }
      }
      skin.Apply(this.FpSpread1);
      if (skin.Name != "Default")
      {
        this.FpSpread1.CommandBar.BackColor = skin.HeaderBackColor;
        //this.FpSpread1.CommandBar.Background.BackgroundImageUrl = Background.DEFAULT_GRADIENT_MASK_IMAGE;
      }
      else
      {
        this.FpSpread1.CommandBar.Reset();
      }
    }
  }
}